package com.example.onlinereadingsystem.demos.web.controller.web;

import com.example.onlinereadingsystem.demos.web.dto.request.AddNovelParam;
import com.example.onlinereadingsystem.demos.web.dto.request.RemoveNovelParam;
import com.example.onlinereadingsystem.demos.web.dto.vo.ChapterContentVo;
import com.example.onlinereadingsystem.demos.web.dto.vo.ChapterListVo;
import com.example.onlinereadingsystem.demos.web.dto.vo.NovelReadingDetailVo;
import com.example.onlinereadingsystem.demos.web.service.NovelReadingService;
import com.example.onlinereadingsystem.demos.web.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @Description 小说阅读页接口
 * @Author ljm
 * @Date 2024/11/7
 */
@RestController
@RequestMapping("/web/novelReading")
public class NovelReadingController {
    @Autowired
    private NovelReadingService novelReadingService;


    /**
     * @auther ljm
     * @create 2024/11/8
     * @describe 根据id获取章节具体内容
     */
    @GetMapping("/getChapterContent/{id}")
    public Result<ChapterContentVo> getChapterContent(@PathVariable("id") String id) throws IOException {
        return novelReadingService.getChapterContent(id);
    }

    /**
     * @auther ljm
     * @create 2024/11/8
     * @describe 获取所有章节id列表
     */
    @GetMapping("/getChapterList")
    public Result<ChapterListVo> getChapterList(String novelId, String chapterId) {
        return novelReadingService.getChapterList(novelId, chapterId);
    }


}
